package com.gitee.feizns.web.ex.impl;

import com.gitee.feizns.web.domain.result.Ret;
import com.gitee.feizns.web.ex.CustomizeExceptionHandler;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.HttpRequestMethodNotSupportedException;

/**
 * @author feizns
 * @since 2019/7/14
 */
public class HttpRequestMethodNotSupportedExceptionHandler implements CustomizeExceptionHandler<HttpRequestMethodNotSupportedException, String> {

    @Override
    public ResponseEntity<Ret<String>> handle(HttpRequestMethodNotSupportedException e) {
        return ResponseEntity.status(HttpStatus.BAD_REQUEST)
                .body(Ret.err(HttpStatus.BAD_REQUEST.value(), e.getMessage()));
    }

}
